Skip to content

Prevents navigation stalls from clock changes#3406

Merged
dansiegel merged 1 commit into
masterfrom
dev/ds/navigation-delay
Jul 9, 2026
Merged

Prevents navigation stalls from clock changes#3406
dansiegel merged 1 commit into
masterfrom
dev/ds/navigation-delay

Conversation

@dansiegel

Copy link
Copy Markdown
Member

Description of Change

Updates the internal mechanism for tracking the last navigation time within PageNavigationService. Replaces DateTime.Now with Stopwatch.GetTimestamp() to ensure navigation delay calculations are based on a monotonic, high-resolution timer. This change introduces a new helper method, GetRemainingNavigationDelay, which robustly handles scenarios where the device clock might move backward (e.g., due to timezone changes). Previously, a backward clock change could lead to an excessively large calculated delay, causing subsequent navigations to appear frozen. The updated logic caps this delay at the configured minimum, preventing such stalls.

Bugs Fixed

API Changes

Added:

  • internal static TimeSpan MinTimeBetweenNavigations
  • internal static TimeSpan GetRemainingNavigationDelay(long lastNavigateTimestamp, long currentTimestamp)

Behavioral Changes

Applications using Prism.Maui will no longer experience navigation freezes or stalls immediately following a device clock or timezone change that results in the system time moving backward. Navigation will remain responsive and adhere to the minimum navigation delay.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard

Switches from `DateTime.Now` to `Stopwatch.GetTimestamp()` for measuring time between navigations. This ensures that device clock or timezone changes do not incorrectly inflate navigation delays, which previously caused navigation to appear frozen (issue #3405).
@dansiegel dansiegel merged commit e7cf2b9 into master Jul 9, 2026
6 checks passed
@dansiegel dansiegel deleted the dev/ds/navigation-delay branch July 9, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Changing device time to past value causes Prism navigation to freeze

1 participant